package com.zzyl;


import com.zzyl.service.ReservationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@Configuration
@EnableScheduling
public class ScheduleHandler {
  @Autowired
  private ReservationService reservationService;
  @Scheduled(cron = "0 0/30 * * * ?")//一小时一次
  public void scheduled() {
    reservationService.expired();
    System.out.println("更新成功");
  }

}